window.onload=function(){WindowHeight(0)}



//检测表单
function CheckForm(form){
	if ($name('mode')[0].checked==true){
		alert("金额类型不能都为无.");return false
	}
	if ($name('mode')[0].checked==false){
		if ($id('money').value == ""){alert("金额不能为空");$id('money').focus();return false;}
	}
	
	if ($id('note').value == ""){alert("备注不能为空");$id('note').focus();return false;}
}



// 金额模式选择
function MoneyMode(str){
	if ($name("mode")[0].checked){
		$id("moneyK").style.display = "none";
	}else{
		$id("moneyK").style.display = "";
	}
	if ($id("mode1").checked){
		$id("giveBox").style.display = "";
	}else{
		$id("giveBox").style.display = "none";
	}
	if ($id("mode2").checked){
		$id("xiaofeiBox").style.display = "";
	}else{
		$id("xiaofeiBox").style.display = "none";
	}
}



// 导出表单检测
function CheckExportForm(){
	/*
	if ($id('refMode').value != ""){
		if ($id('refMoney').value == ""){
			alert("请选择余额金额部分");$id('refMoney').focus();return false;
		}
	}
	if ($id('refConsumedType').value != ""){
		if ($id('refConsumed').value == ""){
			alert("请选择已消费金额部分");$id('refConsumed').focus();return false;
		}
	}
	*/
}



// 选择查询还是导出
function RefFormSubmit(str){
	if (str=="refer"){
		$id('refForm').method='get';
		$id('refForm').action='';
		$id('refForm').target='';
		$id('refForm').submit();
	}else{
		$id('refForm').method='post';
		$id('refForm').action='moneyRecord_deal.php?mudi=export';
		$id('refForm').target='ExportDownload';
		$id('refForm').submit();
	}
}



// 不平衡表单检测
function CheckAddMoneyForm(){
	if ($id("note").value==""){
		alert("请输入不平衡原因.");$id("note").focus();return false;
	}
	if (confirm("你确定执行不平衡纠正？")==false){return false;}
}



// 全选
function AdminNameAllSel(){
	for (var i=0;i<$name("refAdminName[]").length;i++){
		$name("refAdminName[]")[i].checked = true;
	}
}

// 全不选
function AdminNameNoSel(){
	for (var i=0;i<$name("refAdminName[]").length;i++){
		$name("refAdminName[]")[i].checked = false;
	}
}

// 反选
function AdminNameRevSel(){
	for (var i=0;i<$name("refAdminName[]").length;i++){
		if ($name("refAdminName[]")[i].checked){
			$name("refAdminName[]")[i].checked = false;
		}else{
			$name("refAdminName[]")[i].checked = true;
		}
	}
}



// 显示/关闭注释说明
function CheckNoteStr(){
	if ($id("noteStr").style.display==""){
		$id("noteStr").style.display="none";
	}else{
		$id("noteStr").style.display="";
	}
	WindowHeight(0);
}



// 检测详情页表单
function CheckShowForm(){
	if ($id('cost').value == ""){alert("成本不能为空");$id('cost').focus();return false;}
	if ($id('gain').value == ""){alert("利润不能为空");$id('gain').focus();return false;}
	if (confirm("你确定保存？")==false){ return false; }
}



// 平衡标记
function MakeEquSign(remUserMoney, remMoney, remMoney0, refDate1){
	if (confirm("你确定要标记平衡？")==false){ return false; }
	document.location.href="moneyRecord_deal.php?mudi=moneyTimeAdd&remUserMoney="+ remUserMoney +"&remMoney="+ remMoney +"&remMoney0="+ remMoney0 +"&refDate1="+ refDate1 +"&backURL="+ encodeURIComponent(document.location.href);
}



// 批量设置
function MoreSetTo(){
	if ($id('moreSetTo').value==""){ return false; }
	var selNum = 0;
	for (var i=0;i<$name("selDataID[]").length;i++){
		if ($name("selDataID[]")[i].checked){
			selNum ++;
		}
	}
	if (selNum==0){
		alert('请先选择要设置的记录.');$id('moreSetTo').value="";return false;
	}
	selOptionText = $id('moreSetTo').options[$id('moreSetTo').selectedIndex].text;
	selOptionValue = $id('moreSetTo').value;
	$id('moreSetToCN').value = selOptionText;

	if (confirm("你确定要批量设置成【"+ selOptionText +"】？")==true){
		$id('listForm').action="moneyRecord_deal.php?mudi=moreSet";
		$id('listForm').submit();
	}else{
		$id('moreSetTo').value="";
	}
	
}
